const router = require('express').Router()
const adminController = require('../../controller/adminController')

// 是否登录判断  -- 路由中间件
router.use('/admin', (req, res, next) => {
  // 判断session中是否有对就的值
  if (!req.session.username) {
    res.redirect('/login')
    return;
  }
  next()
})

router.get('/admin', adminController.index)


module.exports = router